﻿<UserControl
    x:Class="BasketballRoster.View.RosterControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BasketballRoster.View"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

    <UserControl.Resources>
        <DataTemplate x:Key="PlayerItemTemplate">
            <TextBlock Style="{StaticResource ItemTextStyle}">
                <Run Text="{Binding Name}"/>
                <Run Text=" #"/>
                <Run Text="{Binding Number}"/>
            </TextBlock>
        </DataTemplate>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Border BorderThickness="2" BorderBrush="Blue" CornerRadius="6" Margin="0,0,40,0">
            <StackPanel Margin="20">
                <TextBlock Text="{Binding TeamName}" 
                           Style="{StaticResource HeaderTextStyle}"/>
                <TextBlock Text="Starting Players" 
                           Style="{StaticResource GroupHeaderTextStyle}" Margin="0,20,0,0"/>
                <ListView ItemsSource="{Binding Starters}" 
                          ItemTemplate="{StaticResource PlayerItemTemplate}" Margin="0,20,0,0"/>
                <TextBlock Text="Bench Players" 
                           Style="{StaticResource GroupHeaderTextStyle}" Margin="0,20,0,0"/>
                <ListView ItemsSource="{Binding Bench}" 
                          ItemTemplate="{StaticResource PlayerItemTemplate}" Margin="0,20,0,0"/>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>